import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaterialPptGroupVO, MaterialPptGroupForm, MaterialPptGroupQuery } from '@/api/goods/materialPptGroup/types';

/**
 * 查询品牌列表
 * @param query
 * @returns {*}
 */

export const listMaterialPptGroup = (query?: MaterialPptGroupQuery): AxiosPromise<MaterialPptGroupVO[]> => {
  return request({
    url: '/order/materialPptGroup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询品牌详细
 * @param id
 */
export const getMaterialPptGroup = (id: string | number): AxiosPromise<MaterialPptGroupVO> => {
  return request({
    url: '/order/materialPptGroup/' + id,
    method: 'get'
  });
};

/**
 * 查询品牌详细
 */
export const getMaterialPptGroupAllList = (): AxiosPromise<MaterialPptGroupVO> => {
  return request({
    url: '/order/materialPptGroup/allList',
    method: 'get'
  });
};

/**
 * 新增品牌
 * @param data
 */
export const addMaterialPptGroup = (data: MaterialPptGroupForm) => {
  return request({
    url: '/order/materialPptGroup',
    method: 'post',
    data: data
  });
};

/**
 * 修改品牌
 * @param data
 */
export const updateMaterialPptGroup = (data: MaterialPptGroupForm) => {
  return request({
    url: '/order/materialPptGroup',
    method: 'put',
    data: data
  });
};

/**
 * 删除品牌
 * @param id
 */
export const delMaterialPptGroup = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/materialPptGroup/' + id,
    method: 'delete'
  });
};

/**
 * 状态修改
 * @param materialPptGroupId 客户端id
 * @param status 状态
 */
export function changeStatus(materialPptGroupId: string, status: string) {
  const data = {
    materialPptGroupId,
    status
  };
  return request({
    url: '/order/materialPptGroup/changeStatus',
    method: 'put',
    data: data
  });
}

export default {
  list:listMaterialPptGroup,
  get:getMaterialPptGroup,
  add:addMaterialPptGroup,
  update:updateMaterialPptGroup,
  del:delMaterialPptGroup,
  getMaterialPptGroupAllList:getMaterialPptGroupAllList
}